<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

        /* 内容 */
        .box1{
            position: relative;
            left: 50px;
            display: inline-block;
            /* 设置内边距撑开梯形 */
            padding: 0 1em .35em;
            color: royalblue;
            text-align: center;
            font-size: 20px;
        }

        /* 底 */
        .box1::before{
            content: '';
            position: absolute;
            top: 0;left: 0;
            z-index: -1;
            transform: scaleY(1.3) perspective(.5em) rotateX(5deg);
            /* 改变原点可调整梯形边 */
            transform-origin: bottom;
            /* transform-origin: left; */
            width: 100%;
            height: 1.4em;
            background-color: bisque;
            
        }
    </style>
</head>
<body>
    <div class="box1">
        适应内容的梯形背景
    </div>
</body>
</html>